<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS函数</title>
</head>
<body>
  <h2>函数调用</h2>
<!--作为方法来调用-->
  <p id="demo"></p>

  <script>
    var myObject = {
      firstName:"Bill",
      lastName: "Gates",
      fullName: function() {
        // return this.firstName + " " + this.lastName;
      return this;
      }
    }
    document.getElementById("demo").innerHTML = myObject.fullName();
  </script>
</body>
</html>